import React, { Component } from 'react'
import { Button } from 'antd';
import { seetingHandle, addCount } from '../../actions/setting'
import { connect } from 'react-redux'
import { Redirect } from 'react-router-dom'
const mapState = (state) => ({
    ...state,
})
@connect(mapState, { seetingHandle, addCount })
class Settings extends Component {
    static getDerivedStateFromProps(props, propsNext) {
        console.log(props.addCount(1))
        console.log(propsNext)
    }

    handleSeeting = () => {
        const data = {
            id: 1,
            name: 'zs'
        };
        this.props.seetingHandle(data)
    }

    add = () => {
        const sums = 1;
        this.props.addCount(sums);
    }

    render() {
        return (
            <div>
                <Button type="primary" onClick={this.handleSeeting}>点击测试</Button>
                <Button type="primary" onClick={this.add}>加法</Button>
            </div>
        )
    }
}
export default Settings